﻿using System;
using System.Collections.Generic;
using System.Text;

namespace TSP
{
    public class PriorityQueue<T> : SortedSet<T>
    {
        public PriorityQueue(IComparer<T> comparer) : base(comparer) { }

        // Adds item to the SortedSet
        public void Enqueue(T item)
        {
            base.Add(item);
        }

        // Removes the item with the smallest priority
        public T Dequeue()
        {
            T result = base.Min;
            base.Remove(base.Min);
            return result;
        }

        // Gets the item with the smallest priority
        public T Peek()
        {
            return base.Min;
        }

        public bool isEmpty()
        {
            return base.Count == 0;
        }
    }

}
